#include<iostream>
using namespace std;
const int N = 1e4 + 10;
int arr[N];
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int sum = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < i; j++) {
			if (arr[j] > arr[i]) {
				sum++;
			}
		}
	}
	cout << sum << endl;
	return 0;
}